<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>设置点标注的文本标签</title>
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <script src="http://webapi.amap.com/maps?v=1.3&key=e51bd3d35de6fe57218feaa7e579481f "></script>
    <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
</head>
<body>
<div id="container"></div>
<div id="tip" class="tip" >鼠标移入点标记试试</div>
<script>
    var map = new AMap.Map('container', {
        resizeEnable: true,
        center: [116.397428, 39.90923],
        zoom: 5
    });
    var marker = new AMap.Marker({
    	icon:'images/drawable-hdpi/arrow_green.png',
        position: [112,38]
    });
    marker.setMap(map);
   // marker2.setMap(map);
    // 设置鼠标划过点标记显示的文字提示
    marker.setTitle('我是marker的title');

    // 设置label标签
    marker.setLabel({//label默认蓝框白底左上角显示，样式className为：amap-marker-label
        offset: new AMap.Pixel(20, 20),//修改label相对于maker的位置
        content: "我是marker的label标签2"
    });
       marker.on('click', function() {
       	marker.setIcon("images/service.png");
       	 var lnglat = new AMap.LngLat(116, 38);
    	map.setCenter(marker.getPosition());
        //alert('您点击了点');
        marker.setLabel({
        	 offset: new AMap.Pixel(-100, -60),//修改label相对于maker的位置
       		 content: "我是marker的label标签<br/>测试位置点击<br/><img src='index.html'>点击</img>"
        });
    });
    function show(){
    	 marker.setLabel({
        	 offset: new AMap.Pixel(-40, -40),//修改label相对于maker的位置
       		 content: "点击弹出框标签后的效果"
        });
    }
    var lineArr = [
        [116.368904, 39.913423],
        [116.382122, 39.901176],
        [116.387271, 39.912501],
        [116.398258, 39.904600]
    ];
    var polyline = new AMap.Polyline({
        path: lineArr,          //设置线覆盖物路径
        strokeColor: "#3366FF", //线颜色
        strokeOpacity: 1,       //线透明度
        strokeWeight: 5,        //线宽
        strokeStyle: "solid",   //线样式
        strokeDasharray: [10, 5] //补充线样式
    });
    polyline.setMap(map);
</script>
</body>
</html>